// -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// -------------------------------------------------------------------
// Textile tags example
// http://en.wikipedia.org/wiki/Textile_(markup_language)
// http://www.textism.com/
// -------------------------------------------------------------------
// Feel free to add more tags
// -------------------------------------------------------------------

TextileSettings = {
	previewParserPath:	'/ajax/markitup/textile', // path to your Textile parser
	onShiftEnter:		{keepDefault:false, replaceWith:'\n\n'},
	markupSet: [
		{name:interpolate(gettext('Heading %s'), [1]), key:'1', openWith:'h1(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...') },
        {name:interpolate(gettext('Heading %s'), [2]), key:'2', openWith:'h2(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...') },
		{name:interpolate(gettext('Heading %s'), [3]), key:'3', openWith:'h3(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...') },
		{name:interpolate(gettext('Heading %s'), [4]), key:'4', openWith:'h4(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...') },
		{name:interpolate(gettext('Heading %s'), [5]), key:'5', openWith:'h5(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...') },
		{name:interpolate(gettext('Heading %s'), [6]), key:'6', openWith:'h6(!(([![Class]!]))!). ', placeHolder:gettext('Your title here...')},
		{name:interpolate(gettext('Paragraph')), key:'P', openWith:'p(!(([![Class]!]))!). '},
		{separator:'---------------' },
		{name:gettext('Bold'), key:'B', closeWith:'*', openWith:'*'},
		{name:gettext('Italic'), key:'I', closeWith:'_', openWith:'_'},
		{name:gettext('Stroke through'), key:'S', closeWith:'-', openWith:'-'},
		{separator:'---------------' },
		{name:gettext('Bulleted list'), openWith:'(!(* |!|*)!)'},
		{name:gettext('Numeric list'), openWith:'(!(# |!|#)!)'}, 
		{separator:'---------------' },
		{name:gettext('Picture'), replaceWith:'![![Source:!:http://]!]([![Alternative text]!])!'}, 
		{name:gettext('Link'), openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:gettext('Your text to link here...') },
		{separator:'---------------' },
		{name:gettext('Quotes'), openWith:'bq(!(([![Class]!])!)). '},
		{name:gettext('Code'), openWith:'@', closeWith:'@'},
		{separator:'---------------' },
		{name:gettext('Table generator'), 
			className:'tablegenerator', 
			placeholder:gettext("Your text here..."),
			replaceWith:function(h) {
				cols = prompt(gettext("How many cols?"));
				rows = prompt(gettext("How many rows?"));
				html = "";
				for (r = 0; r < rows; r++) {
					for (c = 0; c < cols; c++) {
						html += "|"+(h.placeholder||"");	
					}
					html += "|\n";
				}
				return html;
			}
		},
		{name:gettext('Date of the Day'), 
			className:"dateoftheday", 
			replaceWith:function(h) { 
				date = new Date()
				weekday = [gettext("Sunday"),gettext("Monday"),gettext("Tuesday"),gettext("Wednesday"),gettext("Thursday"),gettext("Friday"),gettext("Saturday")];
				monthname = [gettext("January"),gettext("February"),gettext("March"),gettext("April"),gettext("May"),gettext("June"),gettext("July"),gettext("August"),gettext("September"),gettext("October"),gettext("November"),gettext("December")];
				D = weekday[date.getDay()];
				d = date.getDate();
				m = monthname[date.getMonth()];
				y = date.getFullYear();
				h = date.getHours();
				i = date.getMinutes();
				s = date.getSeconds();
				return (D +" "+ d + " " + m + " " + y + " " + h + ":" + i + ":" + s);
			}
		},
		{name:gettext('Preview'), call:'preview', className:'preview'},
	]
}
